<?php

/**
 * InputShipForecast filter form base class.
 *
 * @package    TMD
 * @subpackage filter
 * @author     Thaihosting
 */
abstract class BaseInputShipForecastFormFilter extends BaseFormFilterPropel
{
  public function setup()
  {
    $this->setWidgets(array(
      'DTSAVE_TIME'     => new sfWidgetFormFilterDate(array('from_date' => new sfWidgetFormDate(), 'to_date' => new sfWidgetFormDate(), 'with_empty' => false)),
      'IUSER_ID'        => new sfWidgetFormFilterInput(),
      'SDESC_TH'        => new sfWidgetFormFilterInput(),
      'SDESC_ENG'       => new sfWidgetFormFilterInput(),
    ));

    $this->setValidators(array(
      'DTSAVE_TIME'     => new sfValidatorDateRange(array('required' => false, 'from_date' => new sfValidatorDate(array('required' => false)), 'to_date' => new sfValidatorDate(array('required' => false)))),
      'IUSER_ID'        => new sfValidatorSchemaFilter('text', new sfValidatorInteger(array('required' => false))),
      'SDESC_TH'        => new sfValidatorPass(array('required' => false)),
      'SDESC_ENG'       => new sfValidatorPass(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('input_ship_forecast_filters[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    parent::setup();
  }

  public function getModelName()
  {
    return 'InputShipForecast';
  }

  public function getFields()
  {
    return array(
      'DTTIME_FORECAST' => 'Date',
      'ISHIP_REGION'    => 'Number',
      'DTSAVE_TIME'     => 'Date',
      'IUSER_ID'        => 'Number',
      'SDESC_TH'        => 'Text',
      'SDESC_ENG'       => 'Text',
    );
  }
}
